#include <iostream>
#include <vector>
using namespace std;

int getMaxFac(int x, int y)
{
    int z;
    while (z = x % y)
    {
        x = y;
        y = z;
    }
    return y;
}
int main()
{
    int n, a;
    while (cin >> n >> a)
    {
        vector<int> v(n);
        for (int i = 0; i < n; ++i)
            cin >> v[i];
        for (auto e : v)
        {
            if (e <= a)
                a += e;
            else
                a += getMaxFac(a, e);
        }
        cout << a << endl;
    }
    return 0;
}